<script setup>
import { Locale } from 'vant';
import enUS from 'vant/es/locale/lang/en-US';
import zhCN from 'vant/es/locale/lang/zh-CN';
import esES from 'vant/es/locale/lang/es-ES';
import { watch } from 'vue';

const props = defineProps(['locale'])
watch(() => props.locale, newVal => {
  switch (newVal) {
    case 'zh':
      Locale.use('zh-CN', zhCN);
      break;
    case 'en':
      Locale.use('en-US', enUS);
      break;
    case 'es':
      Locale.use('es-ES', esES);
      break;
  }
}, { immediate: true })
</script>

<template>
  <div class="vantui">
    <h3>Vant UI</h3>
    <br>
    <van-calendar
      :poppable="false"
      :show-confirm="false"
      :style="{ height: '500px' }"
    />
  </div>
</template>

<style>
.vantui{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
</style>